package CasinoMDS;

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.EventQueue;

import javax.swing.JFrame;
import javax.swing.JLayeredPane;
import javax.swing.JPanel;
import javax.swing.JRootPane;
import javax.swing.border.EmptyBorder;
import javax.swing.JLabel;

import java.awt.Font;

import javax.swing.JButton;

import BD.BD_Usuarios_registrados;

import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;

public class Baja extends JFrame {

	private JPanel contentPane;
	private static String user;

	/**
	 * Launch the application.
	 */
	public static void main(String[] args) {
		EventQueue.invokeLater(new Runnable() {
			public void run() {
				try {
					Baja frame = new Baja(user);
					frame.setVisible(true);
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		});
	}

	/**
	 * Create the frame.
	 * @param user 
	 */
	public Baja(final String user) {
		setBackground(new Color(0, 0, 0));
		setResizable(false);
		setVisible(true);
		setTitle("Darse de baja");
		setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
		setBounds(100, 100, 321, 143);
		contentPane = new JPanel();
		contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
		contentPane.setLayout(new BorderLayout(0, 0));
		setContentPane(contentPane);
			
		JLayeredPane layeredPane = new JLayeredPane();
		contentPane.add(layeredPane, BorderLayout.CENTER);
		
		JLabel lblseguroQueDesea = new JLabel("\u00BFSeguro que desea darse de baja?");
		lblseguroQueDesea.setFont(new Font("Tahoma", Font.BOLD, 13));
		lblseguroQueDesea.setBounds(34, 29, 343, 22);
		layeredPane.add(lblseguroQueDesea);
		
		JButton btnCancelar = new JButton("Cancelar");
		btnCancelar.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				dispose();
			}
		});
		btnCancelar.setBounds(10, 71, 89, 23);
		layeredPane.add(btnCancelar);
		
		JButton btnSiEstoySeguro = new JButton("Si, estoy seguro");
		btnSiEstoySeguro.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				BD_Usuarios_registrados.eliminarUsuario(user);
				dispose();
			}
		});
		btnSiEstoySeguro.setBounds(168, 71, 127, 23);
		layeredPane.add(btnSiEstoySeguro);
	}

}
